
#ifndef __GSL_EXT_SYMBOLIC_FUNCTION_H__

#include <gsl/gsl_vector.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct
{
  void *f_evaluator;
  int n;
  char **var_names;
}
gsl_ext_multimin_symbolic_function_f_evaluator;

typedef struct
{
  gsl_ext_multimin_symbolic_function_f_evaluator *f_evaluator;
  void **df_evaluators;
}
gsl_ext_multimin_symbolic_function_df_evaluator;

typedef struct
{
  gsl_ext_multimin_symbolic_function_df_evaluator *df_evaluator;
  void ***d2f_evaluators;
}
gsl_ext_multimin_symbolic_function_d2f_evaluator;

/* function definitions for function evaluators */
gsl_ext_multimin_symbolic_function_f_evaluator *
gsl_ext_multimin_symbolic_function_f_evaluator_alloc(char *expr);

void 
gsl_ext_multimin_symbolic_function_f_evaluator_free(gsl_ext_multimin_symbolic_function_f_evaluator *e);

size_t 
gsl_ext_multimin_symbolic_function_f_evaluator_n(gsl_ext_multimin_symbolic_function_f_evaluator *e);

/* function definitions for gradient evaluators */
gsl_ext_multimin_symbolic_function_df_evaluator *
gsl_ext_multimin_symbolic_function_df_evaluator_alloc(gsl_ext_multimin_symbolic_function_f_evaluator *f_eval);

void 
gsl_ext_multimin_symbolic_function_df_evaluator_free(gsl_ext_multimin_symbolic_function_df_evaluator *e);

size_t 
gsl_ext_multimin_symbolic_function_df_evaluator_n(gsl_ext_multimin_symbolic_function_df_evaluator *e);

/* function definitions for Hessian evaluators */
gsl_ext_multimin_symbolic_function_d2f_evaluator *
gsl_ext_multimin_symbolic_function_d2f_evaluator_alloc(gsl_ext_multimin_symbolic_function_df_evaluator *df_eval);

void 
gsl_ext_multimin_symbolic_function_d2f_evaluator_free(gsl_ext_multimin_symbolic_function_d2f_evaluator *e);

size_t 
gsl_ext_multimin_symbolic_function_d2f_evaluator_n(gsl_ext_multimin_symbolic_function_d2f_evaluator *e);

/* function definitions for the GSL multimin interface */
double 
gsl_ext_multimin_symbolic_function_f(const gsl_vector *x, void *params);

void 
gsl_ext_multimin_symbolic_function_df(const gsl_vector *x, void *params, gsl_vector *g);

void 
gsl_ext_multimin_symbolic_function_d2f(const gsl_vector *x, void *params, gsl_matrix *d2f);

#ifdef __cplusplus
}
#endif

#define __GSL_EXT_SYMBOLIC_FUNCTION_H__

#endif
